<template>
  <button @click="goAdmin">进入首页</button>
</template>
<style lang="scss">
</style>
<script setup>
import {useUserStore} from "@/store/user";
import {getUserInfo} from "@/api/user"

const userStore = useUserStore();
// 访问 state 属性
console.log("userStore.permissions:", userStore.permissions);
getUserInfo();
const hasPermission = (perm) => {
  console.log("perm", perm);
  userStore.permissions.includes(perm);
};

const goAdmin = () => {
  uni.navigateTo({ url: "/pages/admin/index" });
};

// 示例：如何在模板中显示 token (如果需要)
// import { computed } from 'vue'
// const userToken = computed(() => userStore.token)

// 示例：如何调用 action (如果 index 页面需要修改 user store 的状态)
// const updateToken = (newToken) => {
//   userStore.setValue('token', newToken)
// }
</script>
